/*
 Navicat Premium Dump SQL

 Source Server         : 127.0.0.1
 Source Server Type    : MySQL
 Source Server Version : 50744 (5.7.44)
 Source Host           : 127.0.0.1:3306
 Source Schema         : smart_community

 Target Server Type    : MySQL
 Target Server Version : 50744 (5.7.44)
 File Encoding         : 65001

 Date: 06/08/2025 11:28:18
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for sc_community
-- ----------------------------
DROP TABLE IF EXISTS `sc_community`;
CREATE TABLE `sc_community` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '社区ID',
  `community_name` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '社区名称',
  `community_code` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '社区编码',
  `region_id` bigint(20) NOT NULL COMMENT '所属区域ID',
  `manager_id` bigint(20) DEFAULT NULL COMMENT '管理员ID',
  `community_type` tinyint(1) DEFAULT '1' COMMENT '社区类型：1-住宅社区，2-商业社区，3-混合社区',
  `property_company` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '物业公司',
  `property_phone` varchar(15) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '物业电话',
  `developer` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '开发商',
  `build_year` year(4) DEFAULT NULL COMMENT '建设年份',
  `address` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '详细地址',
  `longitude` decimal(10,7) DEFAULT NULL COMMENT '经度',
  `latitude` decimal(10,7) DEFAULT NULL COMMENT '纬度',
  `area` decimal(10,2) DEFAULT NULL COMMENT '社区面积(平方米)',
  `green_rate` decimal(5,2) DEFAULT NULL COMMENT '绿化率(%)',
  `plot_ratio` decimal(5,2) DEFAULT NULL COMMENT '容积率',
  `building_count` int(11) DEFAULT '0' COMMENT '楼栋数量',
  `unit_count` int(11) DEFAULT '0' COMMENT '单元数量',
  `household_count` int(11) DEFAULT '0' COMMENT '户数',
  `resident_count` int(11) DEFAULT '0' COMMENT '居民数量',
  `population` int(11) DEFAULT '0' COMMENT '人口数量',
  `parking_count` int(11) DEFAULT '0' COMMENT '停车位数量',
  `contact_phone` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '联系电话',
  `contact_email` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '联系邮箱',
  `service_hours` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '服务时间',
  `facilities` json DEFAULT NULL COMMENT '配套设施（JSON格式）',
  `images` json DEFAULT NULL COMMENT '社区图片（JSON数组）',
  `description` text COLLATE utf8mb4_unicode_ci COMMENT '社区描述',
  `status` tinyint(1) DEFAULT '1' COMMENT '状态：0-建设中，1-已交付，2-维护中，3-停用',
  `sort_order` int(11) DEFAULT '0' COMMENT '排序字段',
  `create_by` bigint(20) DEFAULT NULL COMMENT '创建人',
  `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_by` bigint(20) DEFAULT NULL COMMENT '更新人',
  `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  `deleted` tinyint(1) DEFAULT '0' COMMENT '是否删除：0-否，1-是',
  `version` int(11) DEFAULT '1' COMMENT '版本号',
  PRIMARY KEY (`id`),
  UNIQUE KEY `uk_community_code` (`community_code`),
  KEY `idx_region_id` (`region_id`),
  KEY `idx_manager_id` (`manager_id`),
  KEY `idx_community_type` (`community_type`),
  KEY `idx_status` (`status`),
  KEY `idx_create_time` (`create_time`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='社区信息表';

-- ----------------------------
-- Records of sc_community
-- ----------------------------
BEGIN;
INSERT INTO `sc_community` (`id`, `community_name`, `community_code`, `region_id`, `manager_id`, `community_type`, `property_company`, `property_phone`, `developer`, `build_year`, `address`, `longitude`, `latitude`, `area`, `green_rate`, `plot_ratio`, `building_count`, `unit_count`, `household_count`, `resident_count`, `population`, `parking_count`, `contact_phone`, `contact_email`, `service_hours`, `facilities`, `images`, `description`, `status`, `sort_order`, `create_by`, `create_time`, `update_by`, `update_time`, `deleted`, `version`) VALUES (1, '智慧花园小区', 'ZHHY001', 330521110, NULL, 1, '智慧物业管理有限公司', '025-83456789', NULL, NULL, '江苏省南京市鼓楼区湖南路188号', NULL, NULL, 125000.00, NULL, NULL, 8, 32, 1280, 3840, 0, 800, '025-83456789', NULL, NULL, NULL, NULL, '现代化智能社区，配套设施完善', 1, 1, 1, '2025-06-21 19:21:53', NULL, '2025-07-10 08:37:10', 0, 1);
INSERT INTO `sc_community` (`id`, `community_name`, `community_code`, `region_id`, `manager_id`, `community_type`, `property_company`, `property_phone`, `developer`, `build_year`, `address`, `longitude`, `latitude`, `area`, `green_rate`, `plot_ratio`, `building_count`, `unit_count`, `household_count`, `resident_count`, `population`, `parking_count`, `contact_phone`, `contact_email`, `service_hours`, `facilities`, `images`, `description`, `status`, `sort_order`, `create_by`, `create_time`, `update_by`, `update_time`, `deleted`, `version`) VALUES (2, '阳光家园', 'YGJY002', 330113100, NULL, 1, '阳光物业服务公司', '025-83567890', NULL, NULL, '江苏省南京市鼓楼区湖南路288号', NULL, NULL, 95000.00, NULL, NULL, 6, 24, 960, 2880, 0, 600, '025-83567890', NULL, NULL, NULL, NULL, '环境优美的生态社区', 1, 2, 1, '2025-06-21 19:21:53', NULL, '2025-07-10 08:37:48', 0, 1);
INSERT INTO `sc_community` (`id`, `community_name`, `community_code`, `region_id`, `manager_id`, `community_type`, `property_company`, `property_phone`, `developer`, `build_year`, `address`, `longitude`, `latitude`, `area`, `green_rate`, `plot_ratio`, `building_count`, `unit_count`, `household_count`, `resident_count`, `population`, `parking_count`, `contact_phone`, `contact_email`, `service_hours`, `facilities`, `images`, `description`, `status`, `sort_order`, `create_by`, `create_time`, `update_by`, `update_time`, `deleted`, `version`) VALUES (3, '一小区', 'TANGQIZHENYIXIAOQU', 330113100, NULL, 1, NULL, NULL, NULL, NULL, '浙江省杭州市临平区塘栖镇', NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, 1, 0, 24, '2025-07-11 01:32:29', 24, '2025-07-11 01:32:29', 0, 1);
INSERT INTO `sc_community` (`id`, `community_name`, `community_code`, `region_id`, `manager_id`, `community_type`, `property_company`, `property_phone`, `developer`, `build_year`, `address`, `longitude`, `latitude`, `area`, `green_rate`, `plot_ratio`, `building_count`, `unit_count`, `household_count`, `resident_count`, `population`, `parking_count`, `contact_phone`, `contact_email`, `service_hours`, `facilities`, `images`, `description`, `status`, `sort_order`, `create_by`, `create_time`, `update_by`, `update_time`, `deleted`, `version`) VALUES (4, '西小河小区', 'XIXIAOHEXIAOQU', 440111008, NULL, 1, NULL, NULL, NULL, NULL, '广州市', NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, 1, 0, 1, '2025-07-11 22:47:07', 1, '2025-07-11 22:47:07', 0, 1);
INSERT INTO `sc_community` (`id`, `community_name`, `community_code`, `region_id`, `manager_id`, `community_type`, `property_company`, `property_phone`, `developer`, `build_year`, `address`, `longitude`, `latitude`, `area`, `green_rate`, `plot_ratio`, `building_count`, `unit_count`, `household_count`, `resident_count`, `population`, `parking_count`, `contact_phone`, `contact_email`, `service_hours`, `facilities`, `images`, `description`, `status`, `sort_order`, `create_by`, `create_time`, `update_by`, `update_time`, `deleted`, `version`) VALUES (5, '超山小区', 'CHAOSHANXIAOQU', 330113100, NULL, 1, NULL, NULL, NULL, NULL, '超山脚下', NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, 1, 0, 9, '2025-07-12 23:09:05', 9, '2025-07-12 23:09:05', 0, 1);
COMMIT;

SET FOREIGN_KEY_CHECKS = 1;
